import request from '@/utils/request'

// export function login(data) {
//   return new Promise((resovle, reject) => {
//     resovle({
//       code: 20000,
//       data: {
//         token: 'admin-token'
//       }
//     })
//   })
// }
/*
export function getInfo(token) {
  return new Promise((resovle, reject) => {
    resovle({
      code: 20000,
      data: {
        avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif',
        introduction: 'I am a super administrator',
        name: 'Super Admin',
        roles: ['admin']
      }
    })
  })
}*/
export function getInfo() {
  return request({
    url: '/idp/identity/0', // 0 表示采用 x-token 令牌的用户获取信息
    method: 'get'
  })
}
// export function logout() {
//   return new Promise((resovle, reject) => {
//     resovle({
//       code: 20000,
//       data: 'success'
//     })
//   })
// }

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

export function getMenu() {
  return request({
    url: '/api/rbac/operator/permissions',
    method: 'get'
  })
}
